const path = require('path')
const {
  override,
  addWebpackAlias,
  addPostcssPlugins,
} = require('customize-cra')
const px2viewport = require('postcss-px-to-viewport')

//添加@别名
const webpackAlias = addWebpackAlias({
  '@': path.resolve(__dirname, 'src'),
})

//配置PostCSS 样式转换插件
const postcssPlugin = addPostcssPlugins([
  //移动端布局viewport 适配方案
  px2viewport({
    //视口宽度
    viewportWidth: 375,
  }),
])

// 导出要进行覆盖的 webpack 配置
module.exports = override(webpackAlias, postcssPlugin)
